package com.acheli.registry.entity.model;

import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
import software.bernie.geckolib.core.animatable.GeoAnimatable;
import software.bernie.geckolib.model.GeoModel;

import static com.acheli.ACHeli.MODID;

public class CustomGeckolibModel<C extends Entity & GeoAnimatable> extends GeoModel<C> {
    private ResourceLocation model = null;
    private ResourceLocation texture = null;
    private ResourceLocation animation = null;

    public CustomGeckolibModel() {

    }
    public void setUp(String model, String texture, String animation) {
        this.model = model.isEmpty()? null : ResourceLocation.tryBuild(MODID, model);
        this.texture = texture.isEmpty()? null : ResourceLocation.tryBuild(MODID, texture);
        this.animation = animation.isEmpty()? null : ResourceLocation.tryBuild(MODID, animation);
    }

    @Override
    public ResourceLocation getModelResource(C animatable) {
        return model;
    }

    @Override
    public ResourceLocation getTextureResource(C animatable) {
        return texture;
    }

    @Override
    public ResourceLocation getAnimationResource(C animatable) {
        return animation;
    }

    public boolean shouldCancel() {
        return model == null || texture == null;
    }
}
